#ifndef SPRCOMPOUND_H
#define SPRCOMPOUND_H

#include "SprQuad.h"
#include "../ResourceHolder.hpp"
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/Transformable.hpp>
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/System/Time.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <memory>
#include <vector>
#include "SprManager.h"

class SprCompound : public sf::Transformable, public sf::Drawable
{
public:
	SprCompound(const sf::Texture& texture);
	SprCompound();

	virtual void			update(sf::Time dt);
	virtual void			draw(sf::RenderTarget& target, sf::RenderStates states) const;

	void					setTexture(const sf::Texture&);

	void					setAnimation(int i);


private:
	void					collectSprites(); // to fill mSprites and sort it with mDepth
	void					collectVertices(); // make into vertices

	std::string				getName() const;
	void					setName(std::string);

	

	
private:
	SprManager					mSpriteManager;

	std::string					mName; //Name of the Entity
	sf::Texture					mTexture;
	sf::Time					accumulate;
	
	sf::VertexArray				mVertices;
	std::vector<SprQuad*>		mSprites;
	Quad 					    *mRootQuad;
	
};

#endif 

